//
// Created by liushuai on 2020/5/31.
//
#include "first_num.h"
<<<<<<< HEAD:cxx/algorithm/src/first_num.cc
int first_num(std::vector<int>&nums){
    int count = 0;
    int current = 0;
    for(auto num:nums){
        if(count == 0){
            count++;
            current = num;
        }else{
            if(current == num)
                count++;
            else
                count--;
        }
    }
    return current;
=======
int first_num(std::vector<int>& nums) {
  int count = 0;
  int current = 0;
  for (auto num : nums) {
    if (count == 0) {
      count++;
      current = num;
    } else {
      if (current == num)
        count++;
      else
        count--;
    }
  }
  return current;
>>>>>>> dev:cxx/algorithm/common/src/first_num.cc
}
